package dbsync4j.core.concrete;

import dbsync4j.core.behavior.DatabaseObject;

/**
 * Abstrai o comportamento padrão de qualquer objeto dentro do banco de dados.
 * 
 * @author Rafael
 *
 */
//@Diffable
public abstract class AbstractDatabaseObject extends AbstractNamedObject implements DatabaseObject {

	//@DiffField
	private String schemaName;
	//@DiffField
	private String catalogName;

	public AbstractDatabaseObject(String name, 
			String remarks,
			String schemaName,
			String catalogName) {

		super(name, remarks);

		this.catalogName = catalogName;
		this.schemaName = schemaName;
	}

	/* (non-Javadoc)
	 * @see dbsync4j.core.behavior.DatabaseObject#getCatalogName()
	 */
	public String getCatalogName() {

		return catalogName;
	}
	/* (non-Javadoc)
	 * @see dbsync4j.core.behavior.DatabaseObject#getSchemaName()
	 */
	public String getSchemaName() {

		return schemaName;
	}

	/* (non-Javadoc)
	 * @see dbsync4j.core.behavior.DatabaseObject#getFullName()
	 */
	@Override
	public String getFullName() {
		
		final StringBuffer buffer = new StringBuffer();
		
		if (catalogName != null && catalogName.length() > 0) {
			buffer.append(catalogName).append(".");
		} 
		
		if (getName() != null) {
			buffer.append(getName());
		}
		
		return buffer.toString();
	}

}